package com.kele.controller.jump;


import com.kele.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

/**
 * 创作人 王箫凯
 * Date 2021/6/6
 * Time 11:21
 * 实现了基本用户的转跳
 * @author 王箫凯
 */
@Controller
@RequestMapping("/userAction")
public class UserJumpController {
    /**
     *
     * @return 到写达博客的页面
     */
    @RequestMapping(value = "/writeBlog")
    public String toWriteBlogs(){
        return "/static_resources/templates/write";
    }

    /**
     *
     * @return 转跳到个人博客界面
     */
    @RequestMapping(value = "/myCollects")
    public String toMyController(){


        return "/static_resources/templates/myCollect";
    }

    /**
     *
     * @return 转跳到个人博客内容管理界面
     */
    @RequestMapping(value = "/manageMyBlogs",method = RequestMethod.GET)
    public String toMyBlogsManagement(){
        return  "/static_resources/templates/contentManagement";
    }

    /**
     *
     * @return 转跳到VIP购买界面
     */
    @RequestMapping(value = "/vipCenter")
    public String toVipCenterPages(){
        return "/static_resources/templates/vipCenter";
    }

    /**
     *
     * @return 转跳到搜索界面
     */
    @RequestMapping(value = "/seek")
    public String toSeek(){

        return "/static_resources/templates/search";
    }
    /**
     * 转跳到个人中心
     * @param request 获取session
     * @param model 数据转发
     * @return 视图解析器
     */
    @RequestMapping("/myInformation")
    public String toPeopleCenter(HttpServletRequest request, Model model){
        User user= (User) request.getSession().getAttribute("User");
        model.addAttribute("user",user);
        return "/static_resources/templates/peopleCenter";
    }

}
